package service.impl;

import bean.dto.Login;
import bean.dto.PermissionQueryPage;
import bean.dto.UserRoleDTO;
import bean.dto.UserRoleQueryPage;
import bean.pojo.Permissions;
import bean.pojo.User;
import bean.vo.UserRoleVo;
import bean.vo.UserVo;
import dao.UserDao;
import dao.UserRoleDao;
import dao.impl.UserDaoImpl;
import dao.impl.UserRoleDaoImpl;
import service.UsersRoleService;
import service.UsersService;

import java.util.List;

/**
 * service.impl
 * User: mcw
 * Date: 2024/12/16 下午6:59
 * motto:   春天（spring）没有虫子（bug)
 * Description:
 * Version: V1.0
 */
public class UsersRoleServiceImpl implements UsersRoleService {
    private UserRoleDao userRoleDao=new UserRoleDaoImpl();
    /**
     * 查询所有记录数
     * @param queryPage
     * @return
     */
    @Override
    public Long findByTotal(UserRoleQueryPage queryPage) {
        return userRoleDao.findByTotal(queryPage);
    }

    /**
     * 分页查询
     * @param queryPage
     * @return
     */
    @Override
    public List<UserRoleVo> findByPage(UserRoleQueryPage queryPage) {
        return userRoleDao.findByPage(queryPage);
    }

    /**
     * 删除用户和角色
     * @param userId
     * @return
     */
    @Override
    public boolean deleteUserRole(Integer userId) {
        return userRoleDao.deleteUserRole(userId);
    }

    /**
     * 添加用户和角色
     * @param userRoleDTO
     * @return
     */
    @Override
    public boolean insert(UserRoleDTO userRoleDTO) {
        return userRoleDao.insert(userRoleDTO);
    }

    /**
     * 修改用户和用户角色
     * @param userRoleDTO
     * @return
     */
    @Override
    public boolean updateUserRole(UserRoleDTO userRoleDTO) {
        return userRoleDao.updateUserRole(userRoleDTO);
    }
}
